package com.zhao.service.impl;

import com.zhao.base.TokenThread;
import com.zhao.service.UserService;
import com.zhao.util.HttpRequest;

import net.sf.json.JSONObject;

public class UserServiceImpl implements UserService{
	public String info_url="https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
	public String user_list_url="https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID";
	
	@Override
	public JSONObject getUserInfo(String openId) {
		info_url=info_url.replace("ACCESS_TOKEN",TokenThread.accessToken.getAccessToken());
		info_url=info_url.replace("OPENID", openId);
		JSONObject json=HttpRequest.httpsRequest(info_url, "GET",null);
		return json;
	}

	@Override
	public JSONObject getUserList() {
		user_list_url=user_list_url.replace("ACCESS_TOKEN",TokenThread.accessToken.getAccessToken());
		user_list_url=user_list_url.replace("NEXT_OPENID","");
		JSONObject json=HttpRequest.httpsRequest(user_list_url, "GET",null);
		return json;
	}

}
